home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / chargens.zip / LOCAL.H < prev    next >
Text File  |  1987-10-25  |  866b  |  39 lines

  1. /* label.h - definitions for use with other programs */
  2. #ifndef FAIL
  3. #include <stdio.h>
  4. #define FAIL       1
  5. #define FOREVER    for (;;)
  6. #define NO         0
  7. #define STDERR     2
  8. #define STDIN      0
  9. #define STDOUT     1
  10. #define SUCCEED    0
  11. #define YES        1
  12. #define bits       ushort
  13. #define bool       int
  14. #define metachar   short
  15. #define tbool      char
  16. #define ushort     unsigned
  17. #define void       int
  18. #define getln(s,n) ((fgets(s,n,stdin) == NULL) ? EOF : strlen(s))
  19. #define ABS(x)     (((x) < 0) ? -(x) : (x))
  20. #define MAX(x,y)   (((x) <(y)) ? (y) : (x))
  21. #define MIN(x,y)   (((x) <(y)) ? (x) : (y))
  22. #endif
  23.  
  24. getline(s, lim)
  25.  
  26. char s[];
  27. int lim;
  28.   {
  29.   int c, i;
  30.  
  31.   i = 0;
  32.   while ( --lim > 0 && (c=getchar()) != EOF && c != '\n')
  33.       s[i++] = c;
  34.   if ( c == '\n')
  35.          s[i++] = c;
  36.   s[i] = '\0';
  37.   return(i);
  38.   }
  39.